<div class="row">
    <div class="col-md-12 widget-module">
        <div class="box-widget">
            <div class="widget-head clearfix">
                <h4 class="pull-left"><?php echo $this->translate('page setting'); ?></h4>
            </div>
            
            <div class="widget-container">
                <div class="widget-block">
                    <div class="widget-content">
                        <form id="usergroup" method="post" class="form-horizontal form-box">
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('about page'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post1" name="about">
                                        <?php foreach($this->posts as $post): ?>
                                            <option <?php if(isset($this->data['about']) && $this->data['about'] == $post->id) echo 'selected="selected"'; ?> value="<?php echo $post->id; ?>"><?php echo $post->title; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('how to buy'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post2" name="how_to_buy">
                                        <?php foreach($this->posts as $post): ?>
                                            <option <?php if(isset($this->data['how_to_buy']) && $this->data['how_to_buy'] == $post->id) echo 'selected="selected"'; ?> value="<?php echo $post->id; ?>"><?php echo $post->title; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('warranty page'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post3" name="warranty">
                                        <?php foreach($this->posts as $post): ?>
                                            <option <?php if(isset($this->data['warranty']) && $this->data['warranty'] == $post->id) echo 'selected="selected"'; ?> value="<?php echo $post->id; ?>"><?php echo $post->title; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('how to install'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post4" name="how_to_install">
                                        <?php foreach($this->posts as $post): ?>
                                            <option <?php if(isset($this->data['how_to_install']) && $this->data['how_to_install'] == $post->id) echo 'selected="selected"'; ?> value="<?php echo $post->id; ?>"><?php echo $post->title; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('help page'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post5" name="help">
                                        <?php foreach($this->posts as $post): ?>
                                            <option <?php if(isset($this->data['help']) && $this->data['help'] == $post->id) echo 'selected="selected"'; ?> value="<?php echo $post->id; ?>"><?php echo $post->title; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label"><?php echo $this->translate('blog page'); ?></label>
                                <div class="col-lg-6">
                                    <select id="post7" class="form-control" multiple="multiple" name="blog[]">
                                        <?php foreach($this->categories as $category): ?>
                                            <option value="<?php echo $category->id; ?>"><?php echo $category->category; ?></option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-lg-2 control-label">&nbsp;</label>
                                <div class="col-lg-4">
                                    <div class="form-actions">
                                        <button type="submit" class="btn btn-primary">
                                            <i class="icon-save"></i>
                                            <?php echo $this->translate('save'); ?>
                                        </button>
                                    </div>
                                </div>
                            </div> 
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
$(document).ready(function(){
    $("#post1").select2();
    $("#post2").select2();
    $("#post3").select2();
    $("#post4").select2();
    $("#post5").select2();
    $("#post6").select2();
    $("#post7").attr('style', 'height: 200px;');
    
    <?php 
        if(isset($this->data['blog']) && count($this->data['blog']) > 0){
            foreach($this->data['blog'] as $blog){
                ?>
                    $("#post7 option[value='<?php echo $blog; ?>']").attr('selected', 'selected');
                <?php
            }
        }
    ?>
});
</script>